﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Kokomo.Mirror.PeFormat
{
	[Description("Data Directory")]
	public class DataDirectoryEntry : PeHeaderStruct
	{
		[TypeConverter(typeof(HexConverter))]
		[DisplayName("Virtual address")]
		public uint VirtualAddress { get; set; }

		[TypeConverter(typeof(HexConverter))]
		public uint Size { get; set; }

		public override string ToString()
		{
			return string.Format("VirtualAddress={0:X8}, Size={1:X8}", this.VirtualAddress, this.Size);
		}

		public bool Contains(long virtualAddress)
		{
			return ((virtualAddress >= this.VirtualAddress)
				&& (virtualAddress < (long)(this.VirtualAddress + this.Size)));
		}
	}
}
